package com.hyt.it.ogt.kq.service.govData.service.kz.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hyt.core.base.BaseServiceImpl;
import com.hyt.it.ogt.kq.service.govData.mapper.kz.ExamCandidateExtMapper;
import com.hyt.it.ogt.kq.service.govData.model.entity.kz.ExamCandidateExt;
import com.hyt.it.ogt.kq.service.govData.service.kz.IExamCandidateExtService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ExamCandidateExtServiceImpl extends BaseServiceImpl<ExamCandidateExtMapper, ExamCandidateExt> implements IExamCandidateExtService {

    /**
     * 批量保存
     * @param records
     */
    @Override
    public Boolean batchSave(List<ExamCandidateExt> records){
        return baseMapper.saveBatch(records) > 0;
    }

    /**
     * 根据考试id来删除
     * @param examIds
     * @return
     */
    @Override
    @DS("kz")
    public Boolean removeByExamIds(List<String> examIds){
        LambdaQueryWrapper<ExamCandidateExt> queryExamCandidateExtWrapper = Wrappers.lambdaQuery();
        queryExamCandidateExtWrapper.in(ExamCandidateExt::getExamId, examIds);
        return this.remove(queryExamCandidateExtWrapper);
    }
}
